package structures;

import java.util.*;

/**
 * Video
 * @author Jose Antonio Prieto
 */
public class Video {

    // =========== Attributes of a Video ===========
    /** Id of the Video */
    private String id;
    /** Next id available */
	private String nextID;
    /** Owner of the Video */
    private String owner;
    // =========== Application Properties ===========
    /** Video name */
    private String title;
    /** Place where the video was recorded */
    private String place;
    /** A character string giving the description of the video */
    private String videoDescription;
    /** The date and time of video creation */
    private String dateTime;
    /** A tag to write keywords or comments on the video besides those 
     *  in videoDescription */
    private String userComment;
    /** Rate of the video: Interest */
    private String interest;
    /** Rate of the video: Quality */
    private String quality;
    /** Rate of the video: Global */
    private String global;
    /** List of tags of the Video */
    private ArrayList<Tag> tags;
    /** URL of the Video */
    private String URL;

    /**
     * Constructor
     */
    public Video() {
        // Atributes Initialization
        id = "";
        nextID = "";
        owner = "";
        // Application Properties
        title = "";
        place = "";
        videoDescription = "";
        dateTime = "";
        userComment = "";
        interest = "";
        quality = "";
        global = "";
        tags = new ArrayList<Tag>();
        URL = "";
    }

    /**
     * To add tags
     * @param k
     */
    public void addTag(Tag k) {
        tags.add(k);
    }

    /**
     * Getter
     * @return
     */
    public ArrayList<Tag> getTags() {
        return tags;
    }

    /**
     * Las tag of the image
     * @return
     */
    public Tag getLastTag() {
        int size = tags.size();
        return tags.get(size - 1);
    }

	/**
	 * Getter
	 * @return the id
	 */
	public String getId() {
		return id;
	}

	/**
	 * Setter
	 * @param id the id to set
	 */
	public void setId(String id) {
		this.id = id;
	}
	
	/**
	 * Getter.
	 * @return the nextID
	 */
	public String getNextID() {
		return nextID;
	}

	/**
	 * Setter.
	 * @param nextID the nextID to set
	 */
	public void setNextID(String nextID) {
		this.nextID = nextID;
	}

	/**
	 * Getter
	 * @return the owner
	 */
	public String getOwner() {
		return owner;
	}

	/**
	 * Setter
	 * @param owner the owner to set
	 */
	public void setOwner(String owner) {
		this.owner = owner;
	}

	/**
	 * Getter
	 * @return the title
	 */
	public String getTitle() {
		return title;
	}

	/**
	 * Setter
	 * @param title the title to set
	 */
	public void setTitle(String title) {
		this.title = title;
	}

	/**
	 * Getter
	 * @return the place
	 */
	public String getPlace() {
		return place;
	}

	/**
	 * Setter
	 * @param place the place to set
	 */
	public void setPlace(String place) {
		this.place = place;
	}

	/**
	 * Getter
	 * @return the videoDescription
	 */
	public String getVideoDescription() {
		return videoDescription;
	}

	/**
	 * Setter
	 * @param videoDescription the videoDescription to set
	 */
	public void setVideoDescription(String videoDescription) {
		this.videoDescription = videoDescription;
	}

	/**
	 * Getter
	 * @return the dateTime
	 */
	public String getDateTime() {
		return dateTime;
	}

	/**
	 * Setter
	 * @param dateTime the dateTime to set
	 */
	public void setDateTime(String dateTime) {
		this.dateTime = dateTime;
	}

	/**
	 * Getter
	 * @return the userComment
	 */
	public String getUserComment() {
		return userComment;
	}

	/**
	 * Setter
	 * @param userComment the userComment to set
	 */
	public void setUserComment(String userComment) {
		this.userComment = userComment;
	}

	/**
	 * Getter
	 * @return the interest
	 */
	public String getInterest() {
		return interest;
	}

	/**
	 * Setter
	 * @param interest the interest to set
	 */
	public void setInterest(String interest) {
		this.interest = interest;
	}

	/**
	 * Getter
	 * @return the quality
	 */
	public String getQuality() {
		return quality;
	}

	/**
	 * Setter
	 * @param quality the quality to set
	 */
	public void setQuality(String quality) {
		this.quality = quality;
	}

	/**
	 * Getter
	 * @return the global
	 */
	public String getGlobal() {
		return global;
	}

	/**
	 * Setter
	 * @param global the global to set
	 */
	public void setGlobal(String global) {
		this.global = global;
	}

	/**
	 * Getter
	 * @return the uRL
	 */
	public String getURL() {
		return URL;
	}

	/**
	 * Setter
	 * @param url the uRL to set
	 */
	public void setURL(String url) {
		URL = url;
	}

	/**
	 * Setter
	 * @param tags the tags to set
	 */
	public void setTags(ArrayList<Tag> tags) {
		this.tags = tags;
	}

	/**
     * Print of the Image
     * @return
     */
    public String toString() {
        String res = "<--Video-->\n";
        if (!id.equals("")){
            res += "\tID: " + id + "\n";
        }
        if(!owner.equals("")) {
            res += "\tOwner: " + owner + "\n";
        }
        if(!title.equals("")) {
            res += "\ttitle: " + title + "\n";
        }
        if(!place.equals("")) {
            res += "\tplace: " + place + "\n";
        }
        if(!videoDescription.equals("")) {
            res += "\tvideoDescription: " + videoDescription + "\n";
        }
        if (!dateTime.equals("")) {
            res += "\tDate time: " + dateTime + "\n";
        }
        if (!userComment.equals("")) {
            res += "\tUser comment: " + userComment + "\n";
        }
        if (!interest.equals("")) {
            res += "\t<--Rate-->\n";
            res += "\t\tInterest: " + interest + "\n";
        }
        if (!quality.equals("")) {
            res += "\t\tQuality: " + quality + "\n";
        }
        if (!global.equals("")) {
            res += "\t\tGlobal: " + global + "\n";
        }
        if (!URL.equals("")) {
            res += "\tURL: " + URL + "\n";
        }
        for (Tag i : tags) {
            res += i.toString();
        }
        return res;
    }
}	
